#include "csgcylinder.h"

CSGCylinder::CSGCylinder(double fRadius , double fHeight){
    //Construct a cylinder with the given radius and height. The cilynder is centered on z axis and its height is counted upside
    //the origin.

    m_fRadius = fRadius;
    m_fHeight = fHeight;
}

double CSGCylinder::evaluateEquation(XYZ p){
    /*Evaluate the equation of the cylinder in p. If p is outside the range of height of the cylinder then the point is
    previously considered outside of the cylinder. Otherwise, the equation is evaluated.*/

    double value = (p.z < 0 || p.z > m_fHeight) ? (double)I_OUTSIDE : (p.x * p.x + p.y * p.y - m_fRadius * m_fRadius);
    return value;
}
